package com.zhoug.map3;

import android.content.Context;

import com.zhoug.common3.Logger;

import org.osmdroid.views.MapView;
import org.osmdroid.views.overlay.Marker;

import java.util.Objects;

/**
 * 自定义marker
 * @Author: zhoug
 * @Date: 2024-12-31
 * @Description:
 */
public class MyMarker extends Marker {
    private static final String TAG = ">>>MyMarker";


    public MyMarker(MapView mapView) {
        super(mapView);
    }

    public MyMarker(MapView mapView, Context resourceProxy) {
        super(mapView, resourceProxy);
    }


    @Override
    public void onDestroy() {
        super.onDestroy();
        Logger.d(TAG, "onDestroy:");
    }

    @Override
    public void onDetach(MapView mapView) {
        super.onDetach(mapView);
        Logger.d(TAG, "onDetach:");

    }

    @Override
    public boolean equals(Object o) {
        if (mId != null) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            MyMarker myMarker = (MyMarker) o;
            return Objects.equals(mId, myMarker.mId);
        }
        return super.equals(o);
    }

    @Override
    public int hashCode() {
        if (mId != null) {
            return Objects.hash(mId);
        }
        return super.hashCode();
    }
}
